package com.cn.study.second.stage.code3.zuoye3;

public class PhoneCard {
    private String cardType;
    private String phoneNumber;
    private String name;
    private String password;
    private int accountBalance;
    private int callTime;
    private int internetTraffic;

    CallPackage callPackage = new CallPackage();
    InternetPackage internetPackage = new InternetPackage();
    /**
     * cardType         卡类型
     * phoneNumber      卡号
     * name             用户名
     * password         密码
     * accountBalance   账户余额
     * callTime         通话时间
     * internetTraffic  总上网流量
     */

    PhoneCard(){};
    public PhoneCard(String cardType, String phoneNumber, String name, String password, int accountBalance, int callTime, int internetTraffic) {
        setCardType(cardType);
        setPhoneNumber(phoneNumber);
        setName(name);
        setPassword(password);
        setAccountBalance(accountBalance);
        setCallTime(callTime);
        setInternetTraffic(internetTraffic);
    }

    public String getCardType() {
        return cardType;
    }

    public void setCardType(String cardType) {
        this.cardType = cardType;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAccountBalance() {
        return accountBalance;
    }

    public void setAccountBalance(int accountBalance) {
        this.accountBalance = accountBalance;
    }

    public int getCallTime() {
        return callTime;
    }

    public void setCallTime(int callTime) {
        this.callTime = callTime;
    }

    public int getInternetTraffic() {
        return internetTraffic;
    }

    public void setInternetTraffic(int internetTraffic) {
        this.internetTraffic = internetTraffic;
    }

    //  订购上网套餐

    //  打印账户信息
    public void show(int... args){
        System.out.println("============================手机卡信息==================================");
        for(int i = 0;i<args.length;i++){
            if(i == 0){
                setCallTime(args[i]);
            }else{
                setInternetTraffic(args[i]);
            }
        }
        showAccountBalance();
    }
    public void showAccountBalance(){
        //  显示账户余额
        System.out.println("==============================账户余额================================");
        System.out.println("手机卡类型:"+getCardType()+"\n卡号:"+getPhoneNumber()+"\n用户名："+getName()+"\n密码："+getPassword()+
                "\n账户余额:"+getAccountBalance()+"\n历史通话时长："+getCallTime()+"分钟\n历史流量使用情况:"+getInternetTraffic()+"GB");
    }
    //  通话消费
    public void addCall(int a,PhoneCard PhoneCard){
        callPackage.callPackage(a,PhoneCard);
    }

    //  流量消费
    public void addInternet(int a,PhoneCard PhoneCard){
        internetPackage.internetPackage(a,PhoneCard);
    }
}